<#import "../layout.html" as c>
    <#import "../list_layout.html" as list>
        <#assign alertList = []/>
        <@c.html title="Index">
        <!-- ================== 开始页面级CSS调用 ================== -->
        <link href="${pluginsRoot}bootstrap-wizard/css/bwizard.min.css" rel="stylesheet"/>
        <!-- 日历控件 -->
        <link href="${pluginsRoot}/jquery.dtGrid/dependents/datePicker/skin/WdatePicker.css" rel="stylesheet"/>
        <link href="${pluginsRoot}/jquery.dtGrid/dependents/datePicker/skin/default/datepicker.css" rel="stylesheet"/>
        <!-- ================== 结束页面级CSS调用 ================== -->
        <@list.html title="热门股票" subTitle="热门股票" alertList=alertList permi="sys:hotStock:save" addBtn=true searchHint="请输入股票名称/股票代码进行搜索">
        <@shiro.hasPermission name="sys:hotStock:publish">
        <input type="hidden" id="hotStockPublish" value="1"/>
        </@shiro.hasPermission>
        <@shiro.hasPermission name="sys:hotStock:back">
        <input type="hidden" id="hotStockBack" value="1"/>
        </@shiro.hasPermission>
        <@shiro.hasPermission name="sys:hotStock:del">
        <input type="hidden" id="hotStockDel" value="1"/>
        </@shiro.hasPermission>
        <@shiro.hasPermission name="sys:hotStock:edit">
        <input type="hidden" id="hotStockEdit" value="1"/>
        </@shiro.hasPermission>

        <!-- 结束用户权限参数 -->
        <!-- 开启添加推荐股票模态窗口 -->
        <div class="modal fade" id="addModal" tabindex="-1" role="dialog">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title"> 新增热门股票 <a class="btn btn-info btn-xs m-l-5" role="button" data-toggle="collapse" href="#OperationTips" aria-expanded="true" title="操作提示"><i class="fa fa-exclamation"></i> 提示 </a> </h4>
                    </div>
                    <div class="modal-body">
                        <ul class="collapse in text-info p-b-10 p-l-15" role="tabpanel" id="OperationTips">
                            <li>请根据表单提示信息正确输入。</li>
                        </ul>
                        <form class="form-horizontal form-bordered p-0" action="${adminRoot}hotStock/json/save" id="addForm" method="post" autocomplete="off" data-parsley-validate="true">

                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3">股票代码<i class="f-s-14 text-danger">*</i>&nbsp;:</label>
                                <div class="col-md-9 col-sm-8">
                                    <input type="text" name="equityCode" id="stockCode" class="form-control" placeholder="请输入股票代码" maxlength="30" autocomplete="off" data-tip="tooltip" data-placement="auto" data-original-title="必填项，输入内容控制在2-30个字符。"  data-parsley-required="true" data-parsley-length="[2, 30]" oninput="selectStock()"/>
                                </div>
                                <div class="col-md-2 text-dangerListT"></div>
                                <ul class="col-md-9 text-dangerList">

                                </ul>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3">股票名称<i class="f-s-14 text-danger">*</i>&nbsp;:</label>
                                <div class="col-md-9 col-sm-8">
                                    <input type="text" name="equityName" id="stockName" class="form-control" placeholder="请输入股票名称" maxlength="30" autocomplete="off" data-tip="tooltip" data-placement="auto" data-original-title="必填项，输入内容控制在2-30个字符。"  data-parsley-required="true" data-parsley-length="[2, 30]"/>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer"><a href="javascript:;" class="btn btn-white" data-dismiss="modal">放弃操作</a><a href="javascript:;" class="btn btn-success" data-loading-text="Loading..." nc-ajax-submit-target="addForm" nc-ajax-submit>确认提交</a></div>
                </div>
            </div>
        </div>
        <!--结束添加模拟账户模态窗口 -->
        <!--开启编辑推荐股票模态窗口-->
        <div class="modal fade" id="editModal" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title"> 编辑推荐股票 <a class="btn btn-info btn-xs m-l-5" role="button" data-toggle="collapse" href="#OperationTipsEdit" aria-expanded="true" title="操作提示"><i class="fa fa-exclamation"></i> 提示 </a> </h4>
            </div>
            <div class="modal-body">
                <ul class="collapse in text-info p-b-10 p-l-15" role="tabpanel" id="OperationTipsEdit">
                    <li>请根据表单提示信息正确输入选择。</li>
                </ul>
                <form class="form-horizontal form-bordered p-0" action="${adminRoot}hotStock/json/edit" id="editForm" method="post" autocomplete="off" data-parsley-validate="true">
                    <input type="hidden" name="id" value="">
                    <div class="form-group">
                        <label class="control-label col-md-2 col-sm-3">股票代码<i class="f-s-14 text-danger">*</i>&nbsp;:</label>
                        <div class="col-md-9 col-sm-8">
                            <input type="text" name="equityCode" id="stockCode1" class="form-control" placeholder="请输入股票代码" maxlength="30" autocomplete="off" data-tip="tooltip" data-placement="auto" data-original-title="必填项，输入内容控制在2-30个字符。"  data-parsley-required="true" data-parsley-length="[2, 30]" oninput="selectStock1()"/>
                        </div>
                        <div class="col-md-2 text-dangerListT"></div>
                        <ul class="col-md-9 text-dangerList">

                        </ul>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2 col-sm-3">股票名称<i class="f-s-14 text-danger">*</i>&nbsp;:</label>
                        <div class="col-md-9 col-sm-8">
                            <input type="text" name="equityName" id="stockName1" class="form-control" placeholder="请输入股票名称" maxlength="30" autocomplete="off" data-tip="tooltip" data-placement="auto" data-original-title="必填项，输入内容控制在2-30个字符。"  data-parsley-required="true" data-parsley-length="[2, 30]"/>
                        </div>
                    </div>
                </form>
                <!-- 结束设置模块-->
            </div>
            <div class="modal-footer"><a href="javascript:;" class="btn btn-white" data-dismiss="modal">放弃操作</a><a href="javascript:;" class="btn btn-success" data-loading-text="Loading..." nc-ajax-submit-target="editForm" nc-ajax-submit>确认提交</a></div>
        </div>
    </div>
</div>
        <!--结束编辑推荐股票模态窗口-->
</@list.html>
<!-- ================== 开始页面级JavaScrip调用 ================== -->
<script src="${pluginsRoot}bootstrap-wizard/js/bwizard.js"></script>
<!-- 表单checkbox项 -->
<script src="${pluginsRoot}bootstrap-switch/bootstrap-switch.min.js"></script>
<!-- 日历控件 -->
<script src="${pluginsRoot}/jquery.dtGrid/dependents/datePicker/WdatePicker.js" defer="defer"></script>
<script src="${jsRoot}hotStock/equity.handle.js"></script>
<!-- ================== 结束页面级JavaScrip调用 ================== -->
<style>
    /*新增股票新名单*/
    ul{
        list-style:none;
    }
    .text-dangerList{
        height:100px;
        overflow-y:scroll;
        overflow-x:hidden;
        display: none;
    }
    .text-dangerList li{
        line-height: 40px;
    }
    .text-dangerListT{
        display:none;
    }
</style>
<script>
    $(document).ready(function(){
        $('#test').find('input[type=checkbox]').bind('click', function(){
            $('#test').find('input[type=checkbox]').not(this).attr("checked", false);
        });
    });
</script>
<script>
    //新增
    function selectStock() {
        var stock = document.getElementById("stockCode").value;
        if(stock != ''){
            $.ajax({
                async: false,
                url: ncGlobal.adminRoot + 'stock/list.json',
                type: "post",
                data: {stockCode:stock},
                success: function (data) {
                    if (data.code == 200) {
                        $('.text-dangerList').show();
                        $('.text-dangerListT').show();
                        var list = data.data,str='';
                        if(list && list.length >0){
                            $.each(list,function(i,v){
                                str += '<li data="'+v.stock_code+'">'+v.stock_code + " " + v.code_name+'</li>'
                            })
                            $('.text-dangerList').html(str);
                            $('.text-dangerList li').click(function(){
                                var thisCode = $(this).attr('data'),
                                    thisCName = $(this).html();
                                thisCName = thisCName.substring(thisCName.indexOf(' ')+1);
                                $('#stockCode').val(thisCode);
                                $('#stockName').val(thisCName);
                                $('.text-dangerList').hide();
                                $('.text-dangerListT').hide();
                            })
                        }
                    } else {
                        $.ncAlert({content: data.message, autoCloseTime: 3});
                    }
                },
//                error: function (e) {
//                    alert("错误！！");
//                }
            });
        }else{
            $('.text-dangerList').hide();
            $('.text-dangerListT').hide();
            $('#stockName').val();
        }
    }
    //    编辑
    function selectStock1() {
        var stock = document.getElementById("stockCode1").value;
        if(stock != ''){
            $.ajax({
                async: false,
                url: ncGlobal.adminRoot + 'stock/list.json',
                type: "post",
                data: {stockCode:stock},
                success: function (data) {
                    if (data.code == 200) {
                        $('.text-dangerList').show();
                        $('.text-dangerListT').show();
                        var list = data.data,str='';
                        if(list && list.length >0){
                            $.each(list,function(i,v){
                                str += '<li data="'+v.stock_code+'">'+v.stock_code + " " + v.code_name+'</li>'
                            })
                            $('.text-dangerList').html(str);
                            $('.text-dangerList li').click(function(){
                                var thisCode = $(this).attr('data'),
                                    thisCName = $(this).html();
                                thisCName = thisCName.substring(thisCName.indexOf(' ')+1);
                                $('#stockCode1').val(thisCode);
                                $('#stockName1').val(thisCName);
                                $('.text-dangerList').hide();
                                $('.text-dangerListT').hide();
                            })
                        }
                    } else {
                        $.ncAlert({content: data.message, autoCloseTime: 3});
                    }
                },
//                error: function (e) {
//                    alert("错误！！");
//                }
            });
        }else{
            $('.text-dangerList').hide();
            $('.text-dangerListT').hide();
            $('#stockName1').val();
        }
    }
</script>
</@c.html>
